<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        var num = 10;
        const person = {
            num: 20,
            printNum: function () {
                console.log(this.num);
            },
            innerFunction: function () {
                setTimeout(function () {
                    console.log(this.num);
                }, 1000);
            },
            arrowInnerFunction: function () {
                setTimeout(() => {
                    console.log(this.num);
                }, 1000);
            },
        };
        person.printNum(); //20
        person.innerFunction(); // 10
        person.arrowInnerFunction(); // 20
    </script>
</body>

</html>